package com.shensi.api.pay.client;

import com.alibaba.fastjson.JSONObject;
import com.shensi.api.pay.param.request.RechargeBalance;
import com.shensi.api.pay.pojo.AppUserSuper;
import com.shensi.api.pay.pojo.AppUserSuperDetail;
import com.shensi.api.pay.pojo.SuperPayOrder;
import com.shensi.common.core.constant.CloudConstant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;
import java.util.Map;
import java.util.TreeMap;

/**
 * 超级会员开通支付订单Controller
 *
 * @author qujia
 * @date 2021-12-20
 */
@Api(tags = "趣加超级会员功能")
@FeignClient(name = CloudConstant.PAY_SERVER)
public interface SuperPayOrderClient {


    //查询超级会员
    @Transactional
    @PostMapping("/appUserSuperList")
    @ApiOperation(value = "查询超级会员")
    public String appUserSuperList(@RequestBody AppUserSuper appUserSuper);

    //查询用户身份
    @Transactional
    @PostMapping("/appUserSuperDetail")
    @ApiOperation(value = "查询用户身份")
    public String appUserSuperDetail(@RequestBody AppUserSuperDetail appUserSuperDetail);

    //用户开通超级会员生成支付记录
    @Transactional
    @PostMapping("/createSuperPayOrder")
    @ApiOperation(value = "用户开通超级会员生成支付记录")
    public String rechargeBalance(@RequestBody SuperPayOrder superPayOrder);


    //开通超级会员拉起第三方支付
    @RequestMapping(value = "/appUserSuperToThirdPayment", method = RequestMethod.POST)
    @ApiOperation(value = "公众号充值拉起第三方支付", httpMethod = "POST", notes = "开通超级会员拉起第三方支付")
    public String rechargeToThirdPayment(@RequestBody RechargeBalance rechargeBalance);



    @RequestMapping(value = "/tLSVIPPayCallback", consumes = "application/x-www-form-urlencoded", method = RequestMethod.POST)
    @Transactional
    public void tLSVIPPayCallback(@RequestParam("request") HttpServletRequest request, @RequestParam("response") HttpServletResponse response);


    //超级会员开通功能随行付回调功能
    @RequestMapping(value = "/getSVIPCallback", consumes = "application/json", method = RequestMethod.POST)
    @Transactional
    public JSONObject getSVIPCallback(@RequestBody JSONObject request);

    /***
     * 公众号 云闪付扫呗  超级会员开通功能支付回调
     * @param params
     * @return
     */
    @RequestMapping(value = "/getYunPaySVIPCallback", consumes = "text/xml", method = RequestMethod.POST)
    @Transactional
    public net.sf.json.JSONObject getYunPaySVIPCallback(@RequestBody String params);

    /**
     * 超级会员云化充值回调
     *
     * @param request
     * @param response
     */
    @RequestMapping(value = "/getSVIPYunhuaCallback", consumes = "application/json", method = RequestMethod.POST)
    public void yunHuaCardNotice(@RequestParam("request") HttpServletRequest request, @RequestParam("response") HttpServletResponse response);
}
